package com.gxa.community.admin.mapper.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxa.community.core.pojo.domain.AdminRole;
import com.gxa.community.core.pojo.domain.Menu;
import com.gxa.community.core.pojo.dto.system.RoleNameDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleMapper extends BaseMapper<AdminRole> {
    List<RoleNameDTO> selectAllRoleName();
    //删除角色时，删除角色菜单中间表相关信息
    Integer deleteRoleMenuRelativeByRoleId(Integer id);

    //获取指定角色id的所有菜单
    List<Menu> selectMenusByRoleId(Integer id);

    //查询所有菜单
    List<Menu> selectAllMenu();

    //新增角色时向角色菜单中间表添加角色的菜单数据
    Integer insertIntoRoleMenu(@Param("roleId") Integer roleId,@Param("menuId") Integer menuId);


}
